{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import sdm as sdmlib\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "from IPython.display import clear_output\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "bits = 1000\n",
    "sample = 1000000\n",
    "scanner_type = sdmlib.SDM_SCANNER_THREAD"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "v = []\n",
    "for _ in xrange(sample):\n",
    "    v.append(sdmlib.Bitstring.init_random(bits))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1000000"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(v)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "ref = v[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "d = []\n",
    "for bs in v:\n",
    "    dist = ref.distance_to(bs)\n",
    "    if dist > 0:\n",
    "        d.append(dist)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "d.sort()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "([422,\n",
       "  423,\n",
       "  425,\n",
       "  429,\n",
       "  430,\n",
       "  430,\n",
       "  432,\n",
       "  432,\n",
       "  432,\n",
       "  432,\n",
       "  433,\n",
       "  433,\n",
       "  433,\n",
       "  433,\n",
       "  433,\n",
       "  434,\n",
       "  434,\n",
       "  435,\n",
       "  435,\n",
       "  435,\n",
       "  435,\n",
       "  435,\n",
       "  436,\n",
       "  436,\n",
       "  436],\n",
       " [563,\n",
       "  563,\n",
       "  563,\n",
       "  563,\n",
       "  563,\n",
       "  564,\n",
       "  564,\n",
       "  564,\n",
       "  565,\n",
       "  565,\n",
       "  565,\n",
       "  566,\n",
       "  566,\n",
       "  566,\n",
       "  568,\n",
       "  568,\n",
       "  568,\n",
       "  569,\n",
       "  570,\n",
       "  570,\n",
       "  571,\n",
       "  572,\n",
       "  573,\n",
       "  577,\n",
       "  577])"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d[:25], d[-25:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
